package com.dg11185.nearshop.net.request;

import com.dg11185.libs.utils.MD5.MD5Utils;
import com.dg11185.nearshop.app.Constants;
import com.dg11185.nearshop.net.HttpCacheRequest;
import com.dg11185.nearshop.net.response.GetMerchantPhotoListResponse;

public class GetMerchantPhotoListRequest extends HttpCacheRequest<GetMerchantPhotoListResponse>{

    public GetMerchantPhotoListRequest(String merchantId) {
        super(Constants.ADDRESS, Constants.getPhotoList);
        addParam("chshToken", Constants.TOKEN);
        addParam("merchantId", merchantId);
        setIsCreateFloder(true);
    }

    /**
     * 添加可选参数
     * <param name="pageNumber">当前页</param>
     * <param name="pageSize">每页数量</param>
     */
    public GetMerchantPhotoListRequest add(String key, String value){
        addParam(key, value);
        return this;
    }
    
    public GetMerchantPhotoListRequest encryption(){
        addParam("chshSign", MD5Utils.getMD5Str(getParams(), Constants.MD5_key));
        return this;
    }
    
    @Override
    protected GetMerchantPhotoListResponse parseJson(String response) throws Exception {
        GetMerchantPhotoListResponse r = new GetMerchantPhotoListResponse();
        r.parseJson(response);
        return r;
    }

}
